#ifndef COMMANDPOOL_H
#define COMMANDPOOL_H

#include "autoload.h"

class CommandPool
{
private:
    QQueue<QDomDocument> commands;
    QMutex mute;
public:
    CommandPool()
    {
        commands = QQueue<QDomDocument>();
    }

    void Enqueue(QDomDocument command)
    {
        mute.lock();
        commands.enqueue(command);
        mute.unlock();
    }

    QDomDocument Dequeue()
    {
        QDomDocument command;
        mute.lock();
        command = commands.dequeue();
        mute.unlock();
        return command;
    }

    int Count()
    {
        return commands.size();
    }
};

#endif // COMMANDPOOL_H
